﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;

class SettingPanel : MonoBehaviour
{
    public Toggle FullScreen = null;
    public Toggle EasyOpration = null;
    public Toggle AudioToggle = null;
    public Slider UIScaler = null;

    float m_UIScale = -1;
    private void Start()
    {
        FullScreen.isOn = Screen.fullScreen;
        EasyOpration.isOn = Player.Instance.m_EasyOperation;
        AudioToggle.isOn = !Player.Instance.OpenAudio;
        UIScaler.value = Player.Instance.m_UIScale;
    }

    private void Update()
    {
        
    }

    public void OnFullScreenChanged(bool value)
    {

        if(value)
        {
            Screen.SetResolution(1920,1080,true);
        }
        else
        {
            Screen.SetResolution(1280, 720, false);
        }
    }

    public void OnShutupChanged(bool value)
    {
        Player.Instance.OpenAudio = !value;
    }
    public void OnUIScaleChanged(float value)
    {
        m_UIScale = value;
    }
    public void OnConfrimClicked()
    {
        Player.Instance.m_UIScale = m_UIScale;
    }
    public void OnUIScaleReset()
    {
        UIScaler.value = -1;
        Player.Instance.m_UIScale = -1;
    }

    public void OnEasyOperationChanged(bool value)
    {
        Player.Instance.m_EasyOperation = value;
    }
}